<%@ page language="java" contentType="text/html" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/jsp/common/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no,minimum-scale=1,maximum-scale=1.0" />
<meta name="format-detection" content="telephone=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<title>红高粱首页</title>
<script type="text/javascript" src="m/js/jquery.min.js"></script>
<script type="text/javascript" src="m/js/cart.js"></script>
<style type="text/css">
body{ width:100%; height:auto;margin-top:9.2%;background-image:url("m/images/c_shop_bg2.png");}
.clear{ clear:both;}
h2{ font:normal 20px "黑体"; color:#EEE;line-height:26px;z-index:5; }

*{ margin:0; padding:0;}
.main{ width:100%;}
.jf,.kd,.ys{ padding-top:10px; width:100%; margin:0 auto;}
.main  a{ text-decoration:none;}
.main .img{ width:100%; margin:0 auto; margin-top:0px; line-height:0px;  border-radius:0.3em;}
.main .img img{ width:100%;}
.main .tel { width:210px; margin:0 auto;background:url(m/images/tel_bg.png) no-repeat;background-position:center;background-size:contain; height:35px; text-align:center; padding:8px 0 0 10px; margin-top:5px; text-shadow:0 1px 1px #666;}
.main .tel a{font:normal 20px "黑体"; color:#fff;}
.main .tel .teldiv{margin-top:1.5%;padding:0px}
</style>
</head>

<!-- 

.main .txt{width:100%; height:100%; margin:0 auto; margin-top:20px;background:url(m/images/c_shop_bg.png) no-repeat; background-size:contain; background-position:top;text-align:center;line-height:32px; padding-bottom:9px; bottom:0px;z-index:1;}
h3{color:#999; font-size:14px; font-weight:normal; padding:0 0 15px;}
.jf,.kd,.ys{ padding-top:10px; width:100%; margin:0 auto;border-bottom:1px dashed #7f8487;}border-bottom:有根儿虚线
 -->
<body>
	<div class="main">
    	<c:forEach var="r" items="${restaurants}" varStatus="var">
	    	<div class="jf">
	        	<div class="img" style="position:relative">
	        		<a href="javascript:check('${r.id }', '${currentRestaurantId }', '<c:url value="/category/foods/${r.id}?cid=${loginId }#mp.weixin.qq.com"/>');"><img src="${r.images }">
	        		</a>
	        		<div class="txt" style="position:absolute;bottom:0px; width:100%; height:30%">
	        			<div style="background:url(m/images/c_shop_bg.png) no-repeat; opacity:3; height:100%; text-align:center;">
	        				<div style="padding-top:3%">
	        					<h2>${r.name }</h2>
	        				</div>
	        			</div>
	        		</div>
	        	</div>          
	        	<!-- 
	            <div class="tel">
	            	<div style="text-align:center; padding:29px 10px 0 20px;text-shadow:0 1px 1px #666;">	        	
	        	 -->
	        	 <div style="{width:80%; margin:0 auto; height:80px; padding:8px 0 0 10px; margin-top:0px; text-shadow:0 1px 1px #666;}">
		            <div class="tel">
		            	<div class="teldiv">
		            		<a href="tel:${r.phone }">${r.phone }</a>
		            	</div>
		            </div>
	            </div>
	        </div>
    	</c:forEach>
    </div>
    
<script type="text/javascript">
function check(next, prev, url)
{
	var length = $.cart.length();
	if(length <= 0) {
		window.location.href = url;
		return;
	}
	if(next!=prev) {
		if(confirm("切换店铺会清空购物车,确定?")) {
			window.localStorage.cart = "[]";
			window.location.href = url;
		}
	} else {
		window.location.href = url;
	}
}
</script>

<script type="text/javascript">
$(function(){
	 var length = $.cart.length();
	 //如果由红客会切到红高粱
	 <% if("0000000000" == request.getSession().getAttribute("currentRestaurantId")){%>
		 if(length > 0) {
			if(confirm("进入红高粱，是否清空购物车?")) {
				window.localStorage.cart = "[]";
			} else {
				window.location.href = "rcategory?cid=${loginId}";
			}
		 }
		 //无论清不清空，都切换当前店铺为红客会
		<%	 request.getSession().setAttribute("currentRestaurantId", "0000000000"); } %>
});
</script>

</body>
<%@ include file="footer.jsp" %>
</html>
